package com.gopay.common.user.dao.impl;

import java.io.Serializable;
import java.util.List;

import com.gopay.common.domain.riskcontrol.RcComLimitConf;
import org.apache.commons.lang.StringUtils;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.user.identify.PersIdUsedQuotaLog;
import com.gopay.common.user.dao.PersIdUsedQuotaLogDAO;

/**
 * 身份证已用额度日志
 * 
 * @PersIdUsedQuotaLogDAOImpl.java
 * @author dak.wang
 * @2016年5月25日 下午2:41:33 www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("persIdUsedQuotaLogDAO")
public class PersIdUsedQuotaLogDAOImpl extends BaseDAOImpl<PersIdUsedQuotaLog, Serializable>
        implements PersIdUsedQuotaLogDAO {

    @Override
    public PersIdUsedQuotaLog findByOrderId(String orderId) {
        DetachedCriteria criteria = DetachedCriteria.forClass(PersIdUsedQuotaLog.class);
        criteria.add(Restrictions.eq("gopayOrderId", orderId));
        List<PersIdUsedQuotaLog> list = this.findByCriteria(criteria);
        return (list != null && list.size() > 0) ? list.get(0) : null;
    }

    @Override
    public List<PersIdUsedQuotaLog> findListByOrderId(String orderId) {
        DetachedCriteria criteria = DetachedCriteria.forClass(PersIdUsedQuotaLog.class);
        criteria.add(Restrictions.eq("gopayOrderId", orderId));
        return this.findByCriteria(criteria);
    }
}
